<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:conv="clr-namespace:QuickZip.Converters"            
    xmlns:local="clr-namespace:QuickZip.UserControls" 
    xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
    xmlns:classic="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic"
    >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Brushes.xaml" />
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Converters.xaml" />
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Geometry.xaml" />
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Styles.xaml" />
        <ResourceDictionary Source="pack://application:,,,/QuickZip.UserControls;component/Themes/Templates.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style x:Key="{x:Type local:NavigatorBase}"                       
           TargetType="{x:Type local:NavigatorBase}" >
        <Setter Property="HorizontalAlignment" Value="Left"  />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:NavigatorBase}">
                    <Grid Name="MainGrid">                        
                        <!--<Ellipse  Stroke="Silver" Opacity="0.5" StrokeThickness="1" Margin="2,2" />-->
                        <DockPanel DockPanel.Dock="Top" x:Name="MainDock" >

                            
                            <Button x:Name="btnPrev" DockPanel.Dock="Left" Style="{StaticResource leftNavButtonStyle}" Margin="2,0" IsEnabled="{TemplateBinding CanGoPrev}" />
                            <Button x:Name="btnNext" DockPanel.Dock="Left" Style="{StaticResource rightNavButtonStyle}" IsEnabled="{TemplateBinding CanGoNext}" />

                            <Grid  SnapsToDevicePixels="True" >
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="0"  />
                                </Grid.ColumnDefinitions>

                                <StackPanel x:Name="basePanel" SnapsToDevicePixels="True" Orientation="Horizontal" Grid.Column="0" Margin="0" >

                                    <ToggleButton IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" 
                                              x:Name="buttonExpand"  Width="10" BorderThickness="0" Padding="0" Margin="0" BorderBrush="Transparent" Background="Transparent"
                                              MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" VerticalAlignment="Stretch"
                                              KeyboardNavigation.IsTabStop="False" Focusable="False"                                               >
                                        <ToggleButton.Template>
                                            <ControlTemplate>
                                                <classic:ClassicBorderDecorator Background="{TemplateBinding Panel.Background}" BorderStyle="Raised" BorderBrush="{TemplateBinding Border.BorderBrush}" BorderThickness="3,3,3,3" Name="ContentContainer" SnapsToDevicePixels="True">
                                                    <ContentPresenter RecognizesAccessKey="True" Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" Margin="{TemplateBinding Control.Padding}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                                                </classic:ClassicBorderDecorator>
                                            </ControlTemplate>
                                        </ToggleButton.Template>
                                        <ToggleButton.Content>
                                            <Path Stroke="Black" Fill="Black" Data="{StaticResource expandlArrow}" />
                                        </ToggleButton.Content>
                                    </ToggleButton>


                                </StackPanel>

                                <Popup IsOpen="{TemplateBinding ComboBox.IsDropDownOpen}" 
                                       Placement="Bottom"    PlacementTarget="{Binding ElementName=MainDock}"
                                       MinWidth="{Binding ElementName=basePanel, Path=ActualWidth}"
                                       PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"                                               
                                       AllowsTransparency="True" x:Name="PART_Popup" Margin="1,1,1,1"  Grid.ColumnSpan="2">
                                    <Border BorderThickness="1,1,1,1" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" 
                                            Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" Name="DropDownBorder">
                                        <ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="Auto">
                                            <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                                        </ScrollViewer>
                                    </Border>
                                </Popup>

                            </Grid>
                        </DockPanel>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
